package com.irdstudio.efp.riskm.api.rest;

import java.util.List;

import com.irdstudio.efp.riskm.service.facade.ColltSmsNoticeAppService;
import com.irdstudio.efp.riskm.service.vo.ColltSmsNoticeAppVO;
import org.apache.logging.log4j.ThreadContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import com.irdstudio.basic.framework.core.constant.DataRuleType;
import com.irdstudio.basic.framework.core.constant.ResponseData;
import com.irdstudio.basic.framework.core.util.TraceUtil;
import com.irdstudio.basic.framework.web.controller.AbstractController;
import com.irdstudio.efp.e4a.service.facade.SRoleDataRuleService;



/**
 * Controller：催收短信通知申请表
 * @author ligm
 * @date 2019-08-27 
 */
@RestController
@RequestMapping("/api")
public class ColltSmsNoticeAppController extends AbstractController  {
	
	@Autowired
	@Qualifier("colltSmsNoticeAppService")
	private ColltSmsNoticeAppService colltSmsNoticeAppService;
    
	@Autowired
	@Qualifier("sRoleDataRuleService")
	private SRoleDataRuleService sRoleDataRuleService;


    /**
	 * 新增数据 
	 * @param inColltSmsNoticeAppVo
	 * @return 
	 */
    @PostMapping(value="/collt/sms/notice/app")
	public @ResponseBody ResponseData<Integer> insertColltSmsNoticeApp(@RequestBody ColltSmsNoticeAppVO inColltSmsNoticeAppVo) {
		int outputVo = colltSmsNoticeAppService.insertColltSmsNoticeApp(inColltSmsNoticeAppVo);
		return getResponseData(outputVo);	
	}

    /**
	 * 根据主键删除信息 
	 * @param inColltSmsNoticeAppVo
	 * @return 
	 */
	@DeleteMapping(value="/collt/sms/notice/app")
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody ColltSmsNoticeAppVO inColltSmsNoticeAppVo) {
		int outputVo = colltSmsNoticeAppService.deleteByPk(inColltSmsNoticeAppVo);
		return getResponseData(outputVo);
	}

    /**
	 * 根据主键更新信息 
     * @param inColltSmsNoticeAppVo
	 * @return 
	 */
	@PutMapping(value="/collt/sms/notice/app")
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody ColltSmsNoticeAppVO inColltSmsNoticeAppVo) {
		int outputVo = colltSmsNoticeAppService.updateByPk(inColltSmsNoticeAppVo);
		return getResponseData(outputVo);
	}

    /**
	 * 根据主键查询详情 
     * @param colltSmsNoticeApp
	 * @return 
	 */
	@GetMapping(value="/collt/sms/notice/app")
	public @ResponseBody ResponseData<ColltSmsNoticeAppVO> queryByPk() {
		ColltSmsNoticeAppVO inVo = new ColltSmsNoticeAppVO();
		ColltSmsNoticeAppVO outputVo = colltSmsNoticeAppService.queryByPk(inVo);
		return getResponseData(outputVo);
	} 

    /**
	 * 列表数据查询 
	 * @param colltSmsNoticeApp
	 * @return 
	 */
	@RequestMapping(value="/collt/sms/notice/apps", method= RequestMethod.POST)
	public @ResponseBody ResponseData<List<ColltSmsNoticeAppVO>> queryColltSmsNoticeAppAll(ColltSmsNoticeAppVO vo) {
	List<ColltSmsNoticeAppVO> outputVo = null;
		setUserInfoToVO(vo);
		// 根据用户角色获取用户权限方案
		/*String dataAuthority = sRoleDataRuleService.getDataRuleType(httpRequest.getRequestURI(), getUserRoles());
		DataRuleType dataRuleType = DataRuleType.getDataRuleType(dataAuthority);

        // 根据权限方案调用不同的方法进行数据查询
		switch (dataRuleType) {
			// 一级数据权限
			case LEVEL_ONE:
				outputVo = colltSmsNoticeAppService.queryAllByLevelOne(vo);
				break;
			// 二级数据权限
			case LEVEL_TWO:
				outputVo = colltSmsNoticeAppService.queryAllByLevelTwo(vo);
				break;
			// 三级数据权限 
			case LEVEL_THREE:
				outputVo = colltSmsNoticeAppService.queryAllByLevelThree(vo);
				break;
			// 四级数据权限
			case LEVEL_FOUR:
				outputVo = colltSmsNoticeAppService.queryAllByLevelFour(vo);
				break;
			// 五级数据权限
			case LEVEL_FIVE:
				outputVo = colltSmsNoticeAppService.queryAllByLevelFive(vo);
				break;
			// 默认为一级数据权限
			default:
				outputVo = colltSmsNoticeAppService.queryAllByLevelOne(vo);
				break;
		}
		return getResponseData(outputVo);	*/
		return null;
	}
}
